﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using D3DSS.FormUI.Properties;

namespace D3DSS.FormUI
{
    public partial class frmSetup : Form
    {
        public frmSetup()
        {
            InitializeComponent();
        }

        private void frmSetup_Load(object sender, EventArgs e)
        {
            chkIsCtrl.Checked = Settings.Default.IsCtrl;
            chkIsAlt.Checked = Settings.Default.IsAlt;
            cmbShortcuts.SelectedIndex = Settings.Default.Shortcuts;
        }

        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (Settings.Default.Shortcuts != cmbShortcuts.SelectedIndex || Settings.Default.IsCtrl != chkIsCtrl.Checked || Settings.Default.IsAlt != chkIsAlt.Checked)
            {
                Settings.Default.IsCtrl = chkIsCtrl.Checked;
                Settings.Default.IsAlt = chkIsAlt.Checked;
                Settings.Default.Shortcuts = cmbShortcuts.SelectedIndex;
                Settings.Default.Save();

                KeyHook.UnRegKey(Program.MainHandle, Settings.Default.HotKeyID);
                KeyHook.RegKey();
            }
            this.Close();
        }
    }
}
